package com.java.action;

import java.util.ArrayList;
import java.util.List;

import com.java.pojo.ComEmp;
import com.java.pojo.ComRole;
import com.java.pojo.ComRoleEmp;
import com.java.service.IRoleService;
import com.opensymphony.xwork2.ActionSupport;
import com.sun.org.apache.bcel.internal.generic.NEW;

public class ShowMappingAction extends ActionSupport{
	
	private IRoleService roleservice;
	
	private ComEmp emp;
	private String id;
	private List<ComRole>rlist=new ArrayList<ComRole>();
	private List<ComRole>list1=new ArrayList<ComRole>();
	private List<ComRole>list2=new ArrayList<ComRole>();
	private List<ComRole>list3=new ArrayList<ComRole>();
	private List<ComRole>list4=new ArrayList<ComRole>();
	private List<ComRole>list5=new ArrayList<ComRole>();
	
	

	public String execute(){
		
		emp = roleservice.getEmpById(id);
		for(ComRoleEmp cre :emp.getComRoleEmps()){
			ComRole role = cre.getId().getComRole();
			rlist.add(role);
		}
		list1 = roleservice.getRoleByType(1);
		
		list2 = roleservice.getRoleByType(2);
		list3 = roleservice.getRoleByType(3);
		list4 = roleservice.getRoleByType(4);
		list5 = roleservice.getRoleByType(5);
		System.out.println("===========================================");
		System.out.println(list1.size());
		System.out.println(rlist.size());
		System.out.println(emp.getComRoleEmps().size());
		return SUCCESS;
	}

	public ComEmp getEmp() {
		return emp;
	}

	public void setRoleservice(IRoleService roleservice) {
		this.roleservice = roleservice;
	}

	public void setId(String id) {
		this.id = id;
	}

	public List<ComRole> getList1() {
		return list1;
	}

	public List<ComRole> getList2() {
		return list2;
	}

	public List<ComRole> getList3() {
		return list3;
	}

	public List<ComRole> getList4() {
		return list4;
	}

	public List<ComRole> getList5() {
		return list5;
	}

	public List<ComRole> getRlist() {
		return rlist;
	}
	

}
